package com.mycompany.crm.utils;

import com.mycompany.crm.exceptions.DateFormatException;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 日期时间校验类(尚未完善)
 * @author jy
 * @version 1.0
 */
public class DateFormatUtil {

    public static void isValidDate(Date date,String msg){

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//        String strDate = sdf.format(date);
        String str = date.toString();
        if (!str.equals(sdf.format(date))){
            throw new DateFormatException(msg);
        }
    }

}
